//
//  user.m
//
//  Created by iDeneb on 11/17/09.
//  Copyright 2009 __MyCompanyName__. All rights reserved.
//

#import "User.h"
static UIImage *yesImage;
static UIImage *noImage;
static UIImage *aImage;
static UIImage *bImage;
static UIImage *cImage;
static UIImage *dImage;
static UIImage *handImage;
static UIImage *votedImage;

@implementation User

@synthesize uid;
@synthesize username;
@synthesize num;
@synthesize choice;
@synthesize image;
@synthesize muted;
@synthesize removed;
@synthesize sock;


+ (void)initialize {
	yesImage = [[UIImage imageNamed:@"YESimage.jpg"] retain];
	noImage = [[UIImage imageNamed:@"NOimage.jpg"] retain];
	aImage = [[UIImage imageNamed:@"Aimage.jpg"] retain];
	bImage = [[UIImage imageNamed:@"Bimage.jpg"] retain];
	cImage = [[UIImage imageNamed:@"Cimage.jpg"] retain];
	dImage = [[UIImage imageNamed:@"Dimage.jpg"] retain];
	handImage = [[UIImage imageNamed:@"Handimage.jpg"] retain];
	votedImage = [[UIImage imageNamed:@"VOTEDimage.jpg"] retain];
}

- (UIImage *)image {
    // Return an image that illustrates the quarter of the current day in the time zone
	if (image == nil) {
		if([choice localizedCompare:@"yes"] == 0){
			self.image = yesImage;
		} else if([choice localizedCompare:@"no"] == 0){
			self.image = noImage;
		} else if([choice localizedCompare:@"a"] == 0){
			self.image = aImage;
		} else if([choice localizedCompare:@"b"] == 0){
			self.image = bImage;
		} else if([choice localizedCompare:@"c"] == 0){
			self.image = cImage;
		} else if([choice localizedCompare:@"d"] == 0){
			self.image = dImage;
		}else if([choice localizedCompare:@"hand"] == 0){
			self.image = handImage;
		} else if([choice localizedCompare:@"voted"] == 0){
			self.image = votedImage;
		} else
			self.image = nil;
	}
	return image;
}

- (UIButton *)showMute {
    // Return an image that illustrates the quarter of the current day in the time zone
	if(self.muted){
		return [[UIButton setTitle:@"MUTE" forState:UIControlStateNormal] retain];
	}else
		return [[UIButton setTitle:@"UNMUTE" forState:UIControlStateNormal] retain];;
}


@end
